package com.zsrt.java.day20161223.zsh.demo06;

import java.util.Scanner;

import org.junit.Test;

public class demo62 {
	@Test
	public void calculatorifelse(){
		
		Scanner input=new Scanner(System.in);
		System.out.println("请输入第一个数字：");
		int first=input.nextInt();
		
		System.out.println("请在计算符号（+、-、*、/、%）中选择一个输入：");
		String sign=input.next();
		
		System.out.println("请输入第二个数字：");
		int second=input.nextInt();
		
		input.close();
		
		if(sign.equals("+")){
			System.out.println(first+" + "+second+" = "+(first+second));	
		}else if(sign.equals("-")){
			System.out.println(first+" - "+second+" = "+(first-second));
		}else if(sign.equals("*")){
			System.out.println(first+" * "+second+" = "+(first*second));
		}else if(sign.equals("/")){
			System.out.println(first+" / "+second+" = "+(first/second));
		}else if(sign.equals("%")){
			System.out.println(first+" % "+second+" = "+(first%second));
		}	
	}

}
